package objects;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.geom.Vector2f;

import divers.StaticVariables;

public class Camera {
	
	private Vector2f position = StaticVariables.cameraposition;
	public Vector2f getPosition(){return position;}
	
	
	public void update(GameContainer gc){
		
		position.x = StaticVariables.playerposition.x - gc.getWidth()/2;
		
		if (position.x < StaticVariables.tiles[0].getX()){
			
			position.x = StaticVariables.tiles[0].getX();
		}
		if (position.x + gc.getWidth() > StaticVariables.tiles[StaticVariables.tiles.length-1].getX()+40){
			
			position.x = StaticVariables.tiles[StaticVariables.tiles.length-1].getX()+40 - gc.getWidth();
		}
	}
}
